package com.gemme.gemme.view;

import android.content.Context;
import android.text.TextUtils;
import android.view.View;
import android.widget.ImageView;

import com.bumptech.glide.Glide;
import com.gemme.gemme.R;

public class BigPictureDialog {
    CenterDialog dialog;
    private Context mContext;
    private String url;

    public void showDialog(Context mContext){
//new int[]{R.id.close}
        dialog = new CenterDialog(mContext, R.layout.bigpicture_dialog,null
               );
        this.mContext = mContext;

        dialog.show();
        initView();
        dialog.setOnBottomItemClickListener(new CenterDialog.OnBottomItemClickListener() {
            @Override
            public void onBottomItemClick(CenterDialog dialog, View view) {
                switch (view.getId()) {
                   /* case R.id.close:
                        dialog.dismiss();
                        break;*/

                }
            }
        });
    }
    ImageView iv_picture;
    private void initView() {
        View view = dialog.getView();

        iv_picture = view.findViewById(R.id.iv_picture);
        if(!TextUtils.isEmpty(url)){
            Glide.with(mContext).load(url).into(iv_picture);
        }

        view.findViewById(R.id.close).setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View view) {
                dialog.dismiss();
            }
        });
    }

    public void setUrl(String url){

        this.url = url;
    }


}
